Imports System 
Imports System.Text 
Imports System.Data
Imports System.Data.SqlClient
Imports System.Data.Common
Imports System.Collections
Imports System.Collections.Generic
Imports System.ComponentModel
Imports System.Configuration 
Imports System.Xml 
Imports System.Xml.Serialization
Imports SubSonic 
Imports SubSonic.Utilities
Namespace JPC.Medialibrary.DAL
    Public Partial Class SPs
        
        ''' <summary>
        ''' Creates an object wrapper for the ExisteCarpeta Procedure
        ''' </summary>
        Public Shared Function ExisteCarpeta(ByVal filename As String) As StoredProcedure 
            Dim sp As New SubSonic.StoredProcedure("ExisteCarpeta", DataService.GetInstance("Medialibrary"), "dbo")
            
            sp.Command.AddParameter("@filename", filename, DbType.AnsiString, Nothing, Nothing)
        	    
            
            Return sp
        End Function
        
        ''' <summary>
        ''' Creates an object wrapper for the GetAlbumsByArtist Procedure
        ''' </summary>
        Public Shared Function GetAlbumsByArtist(ByVal ArtistId As Nullable(Of Integer)) As StoredProcedure 
            Dim sp As New SubSonic.StoredProcedure("GetAlbumsByArtist", DataService.GetInstance("Medialibrary"), "dbo")
            
            sp.Command.AddParameter("@ArtistId", ArtistId, DbType.Int32, 0, 10)
        	    
            
            Return sp
        End Function
        
        ''' <summary>
        ''' Creates an object wrapper for the GetAlbumsByInitial Procedure
        ''' </summary>
        Public Shared Function GetAlbumsByInitial(ByVal initial1 As String, ByVal initial2 As String) As StoredProcedure 
            Dim sp As New SubSonic.StoredProcedure("GetAlbumsByInitial", DataService.GetInstance("Medialibrary"), "dbo")
            
            sp.Command.AddParameter("@initial1", initial1, DbType.AnsiStringFixedLength, Nothing, Nothing)
        	    
            
            sp.Command.AddParameter("@initial2", initial2, DbType.AnsiStringFixedLength, Nothing, Nothing)
        	    
            
            Return sp
        End Function
        
        ''' <summary>
        ''' Creates an object wrapper for the GetAlbumsByTag Procedure
        ''' </summary>
        Public Shared Function GetAlbumsByTag(ByVal TagId As Nullable(Of Integer)) As StoredProcedure 
            Dim sp As New SubSonic.StoredProcedure("GetAlbumsByTag", DataService.GetInstance("Medialibrary"), "dbo")
            
            sp.Command.AddParameter("@TagId", TagId, DbType.Int32, 0, 10)
        	    
            
            Return sp
        End Function
        
        ''' <summary>
        ''' Creates an object wrapper for the GetAlbumsByText Procedure
        ''' </summary>
        Public Shared Function GetAlbumsByText(ByVal searchtext As String) As StoredProcedure 
            Dim sp As New SubSonic.StoredProcedure("GetAlbumsByText", DataService.GetInstance("Medialibrary"), "dbo")
            
            sp.Command.AddParameter("@searchtext", searchtext, DbType.AnsiString, Nothing, Nothing)
        	    
            
            Return sp
        End Function
        
        ''' <summary>
        ''' Creates an object wrapper for the GetArtistsByAlbum Procedure
        ''' </summary>
        Public Shared Function GetArtistsByAlbum(ByVal AlbumId As Nullable(Of Integer)) As StoredProcedure 
            Dim sp As New SubSonic.StoredProcedure("GetArtistsByAlbum", DataService.GetInstance("Medialibrary"), "dbo")
            
            sp.Command.AddParameter("@AlbumId", AlbumId, DbType.Int32, 0, 10)
        	    
            
            Return sp
        End Function
        
        ''' <summary>
        ''' Creates an object wrapper for the GetArtistsByInitial Procedure
        ''' </summary>
        Public Shared Function GetArtistsByInitial(ByVal initial1 As String, ByVal initial2 As String) As StoredProcedure 
            Dim sp As New SubSonic.StoredProcedure("GetArtistsByInitial", DataService.GetInstance("Medialibrary"), "dbo")
            
            sp.Command.AddParameter("@initial1", initial1, DbType.AnsiStringFixedLength, Nothing, Nothing)
        	    
            
            sp.Command.AddParameter("@initial2", initial2, DbType.AnsiStringFixedLength, Nothing, Nothing)
        	    
            
            Return sp
        End Function
        
        ''' <summary>
        ''' Creates an object wrapper for the GetArtistsByTag Procedure
        ''' </summary>
        Public Shared Function GetArtistsByTag(ByVal TagId As Nullable(Of Integer)) As StoredProcedure 
            Dim sp As New SubSonic.StoredProcedure("GetArtistsByTag", DataService.GetInstance("Medialibrary"), "dbo")
            
            sp.Command.AddParameter("@TagId", TagId, DbType.Int32, 0, 10)
        	    
            
            Return sp
        End Function
        
        ''' <summary>
        ''' Creates an object wrapper for the GetArtistsByText Procedure
        ''' </summary>
        Public Shared Function GetArtistsByText(ByVal searchtext As String) As StoredProcedure 
            Dim sp As New SubSonic.StoredProcedure("GetArtistsByText", DataService.GetInstance("Medialibrary"), "dbo")
            
            sp.Command.AddParameter("@searchtext", searchtext, DbType.AnsiString, Nothing, Nothing)
        	    
            
            Return sp
        End Function
        
        ''' <summary>
        ''' Creates an object wrapper for the GetPlayListsByText Procedure
        ''' </summary>
        Public Shared Function GetPlayListsByText(ByVal searchtext As String) As StoredProcedure 
            Dim sp As New SubSonic.StoredProcedure("GetPlayListsByText", DataService.GetInstance("Medialibrary"), "dbo")
            
            sp.Command.AddParameter("@searchtext", searchtext, DbType.AnsiString, Nothing, Nothing)
        	    
            
            Return sp
        End Function
        
        ''' <summary>
        ''' Creates an object wrapper for the GetSongsByAlbum Procedure
        ''' </summary>
        Public Shared Function GetSongsByAlbum(ByVal AlbumId As Nullable(Of Integer)) As StoredProcedure 
            Dim sp As New SubSonic.StoredProcedure("GetSongsByAlbum", DataService.GetInstance("Medialibrary"), "dbo")
            
            sp.Command.AddParameter("@AlbumId", AlbumId, DbType.Int32, 0, 10)
        	    
            
            Return sp
        End Function
        
        ''' <summary>
        ''' Creates an object wrapper for the GetSongsByAlbumArtist Procedure
        ''' </summary>
        Public Shared Function GetSongsByAlbumArtist(ByVal AlbumId As Nullable(Of Integer), ByVal ArtistId As Nullable(Of Integer)) As StoredProcedure 
            Dim sp As New SubSonic.StoredProcedure("GetSongsByAlbumArtist", DataService.GetInstance("Medialibrary"), "dbo")
            
            sp.Command.AddParameter("@AlbumId", AlbumId, DbType.Int32, 0, 10)
        	    
            
            sp.Command.AddParameter("@ArtistId", ArtistId, DbType.Int32, 0, 10)
        	    
            
            Return sp
        End Function
        
        ''' <summary>
        ''' Creates an object wrapper for the GetSongsByAlbumTag Procedure
        ''' </summary>
        Public Shared Function GetSongsByAlbumTag(ByVal AlbumId As Nullable(Of Integer), ByVal TagId As Nullable(Of Integer)) As StoredProcedure 
            Dim sp As New SubSonic.StoredProcedure("GetSongsByAlbumTag", DataService.GetInstance("Medialibrary"), "dbo")
            
            sp.Command.AddParameter("@AlbumId", AlbumId, DbType.Int32, 0, 10)
        	    
            
            sp.Command.AddParameter("@TagId", TagId, DbType.Int32, 0, 10)
        	    
            
            Return sp
        End Function
        
        ''' <summary>
        ''' Creates an object wrapper for the GetSongsByArtist Procedure
        ''' </summary>
        Public Shared Function GetSongsByArtist(ByVal ArtistId As Nullable(Of Integer)) As StoredProcedure 
            Dim sp As New SubSonic.StoredProcedure("GetSongsByArtist", DataService.GetInstance("Medialibrary"), "dbo")
            
            sp.Command.AddParameter("@ArtistId", ArtistId, DbType.Int32, 0, 10)
        	    
            
            Return sp
        End Function
        
        ''' <summary>
        ''' Creates an object wrapper for the GetSongsByInitial Procedure
        ''' </summary>
        Public Shared Function GetSongsByInitial(ByVal initial1 As String, ByVal initial2 As String) As StoredProcedure 
            Dim sp As New SubSonic.StoredProcedure("GetSongsByInitial", DataService.GetInstance("Medialibrary"), "dbo")
            
            sp.Command.AddParameter("@initial1", initial1, DbType.AnsiStringFixedLength, Nothing, Nothing)
        	    
            
            sp.Command.AddParameter("@initial2", initial2, DbType.AnsiStringFixedLength, Nothing, Nothing)
        	    
            
            Return sp
        End Function
        
        ''' <summary>
        ''' Creates an object wrapper for the GetSongsByPlaylist Procedure
        ''' </summary>
        Public Shared Function GetSongsByPlaylist(ByVal PlayListId As Nullable(Of Integer)) As StoredProcedure 
            Dim sp As New SubSonic.StoredProcedure("GetSongsByPlaylist", DataService.GetInstance("Medialibrary"), "dbo")
            
            sp.Command.AddParameter("@PlayListId", PlayListId, DbType.Int32, 0, 10)
        	    
            
            Return sp
        End Function
        
        ''' <summary>
        ''' Creates an object wrapper for the GetSongsByTag Procedure
        ''' </summary>
        Public Shared Function GetSongsByTag(ByVal TagId As Nullable(Of Integer)) As StoredProcedure 
            Dim sp As New SubSonic.StoredProcedure("GetSongsByTag", DataService.GetInstance("Medialibrary"), "dbo")
            
            sp.Command.AddParameter("@TagId", TagId, DbType.Int32, 0, 10)
        	    
            
            Return sp
        End Function
        
        ''' <summary>
        ''' Creates an object wrapper for the GetSongsByText Procedure
        ''' </summary>
        Public Shared Function GetSongsByText(ByVal searchtext As String) As StoredProcedure 
            Dim sp As New SubSonic.StoredProcedure("GetSongsByText", DataService.GetInstance("Medialibrary"), "dbo")
            
            sp.Command.AddParameter("@searchtext", searchtext, DbType.AnsiString, Nothing, Nothing)
        	    
            
            Return sp
        End Function
        
        ''' <summary>
        ''' Creates an object wrapper for the GetTagsByInitial Procedure
        ''' </summary>
        Public Shared Function GetTagsByInitial(ByVal initial1 As String, ByVal initial2 As String) As StoredProcedure 
            Dim sp As New SubSonic.StoredProcedure("GetTagsByInitial", DataService.GetInstance("Medialibrary"), "dbo")
            
            sp.Command.AddParameter("@initial1", initial1, DbType.AnsiStringFixedLength, Nothing, Nothing)
        	    
            
            sp.Command.AddParameter("@initial2", initial2, DbType.AnsiStringFixedLength, Nothing, Nothing)
        	    
            
            Return sp
        End Function
        
        ''' <summary>
        ''' Creates an object wrapper for the GetTagsByText Procedure
        ''' </summary>
        Public Shared Function GetTagsByText(ByVal searchtext As String) As StoredProcedure 
            Dim sp As New SubSonic.StoredProcedure("GetTagsByText", DataService.GetInstance("Medialibrary"), "dbo")
            
            sp.Command.AddParameter("@searchtext", searchtext, DbType.AnsiString, Nothing, Nothing)
        	    
            
            Return sp
        End Function
        
        ''' <summary>
        ''' Creates an object wrapper for the LimpiarDB Procedure
        ''' </summary>
        Public Shared Function LimpiarDB() As StoredProcedure 
            Dim sp As New SubSonic.StoredProcedure("LimpiarDB", DataService.GetInstance("Medialibrary"), "")
            
            Return sp
        End Function
        
        ''' <summary>
        ''' Creates an object wrapper for the UpdateSongArtistId Procedure
        ''' </summary>
        Public Shared Function UpdateSongArtistId(ByVal oldArtistId As Nullable(Of Integer), ByVal newArtistId As Nullable(Of Integer)) As StoredProcedure 
            Dim sp As New SubSonic.StoredProcedure("UpdateSongArtistId", DataService.GetInstance("Medialibrary"), "dbo")
            
            sp.Command.AddParameter("@oldArtistId", oldArtistId, DbType.Int32, 0, 10)
        	    
            
            sp.Command.AddParameter("@newArtistId", newArtistId, DbType.Int32, 0, 10)
        	    
            
            Return sp
        End Function
        
        ''' <summary>
        ''' Creates an object wrapper for the UpdateSongTagId Procedure
        ''' </summary>
        Public Shared Function UpdateSongTagId(ByVal oldTagId As Nullable(Of Integer), ByVal newTagId As Nullable(Of Integer)) As StoredProcedure 
            Dim sp As New SubSonic.StoredProcedure("UpdateSongTagId", DataService.GetInstance("Medialibrary"), "dbo")
            
            sp.Command.AddParameter("@oldTagId", oldTagId, DbType.Int32, 0, 10)
        	    
            
            sp.Command.AddParameter("@newTagId", newTagId, DbType.Int32, 0, 10)
        	    
            
            Return sp
        End Function
        
    End Class
        
End Namespace
